<?php

jimport('joomla.application.component.controller');

class bgController extends JController {
    
    public function __construct(){
        parent::__construct();
        
    }
    
    public function display($cachable = false, $urlparams = false) {
        parent::display($cachable, $urlparams);
    }
    
    public function download(){
        //echo '<meta charset="utf-8"/>';
        $folder = JRequest::getVar('folder');
        $file = JRequest::getVar('file');
        //echo $file;die;
        //$file = mb_convert_encoding($file, 'utf-8','shit_jis');
        
        
        $file_name = urldecode($file);
        //$file = $file_name.".".end($name);
           
        $encodeDOWI_PATH = sha1($file_name);
                
        $file_path = "administrator/uploads/".$folder."/".$encodeDOWI_PATH;
       //echo $file_path;die;
        header("Content-Type: application/octet-stream");
        
        header("Content-Encoding: utf-8");
        
        header("Content-disposition:attachment; filename=" . urlencode($file) );
        readfile($file_path);
        exit;
    }
    
    
}
?>